import { defineStore } from 'pinia'
import dayjs from 'dayjs'

export const useTopSelectStore = defineStore(({
    id:'topSelect',
    state: () => ({
        time:dayjs(),
        area:[
            {
              label: '越秀区',
              value: '越秀区'
            },
            {
              label: '海珠区',
              value: '海珠区'
            },
            {
              label: '荔湾区',
              value: '荔湾区'
            },
            {
              label: '天河区',
              value: '天河区'
            },
            {
              label: '白云区',
              value: '白云区'
            },
            {
              label: '黄埔区',
              value: '黄埔区'
            },
            {
              label: '番禺区',
              value: '番禺区'
            },
            {
              label: '花都区',
              value: '花都区'
            },
            {
              label: '南沙区',
              value: '南沙区'
            },
            {
              label: '从化区',
              value: '从化区'
            },
            {
              label: '增城区',
              value: '增城区'
            }
          ],
        selectArea:[]
    }),
    getters: {
        getTime: (state) => state.time,
        getArea: (state) => state.area,
        getSelectArea: (state) => state.selectArea  
    },
    actions: {
        CHANGE_PROPERTY({ key, value }: { key: any, value: any }) {
            if (Reflect.has(this, key)) {
              this[key] = value as any;
              console.log("this[key]",this[key])
            }
          },
        change(data:any) {
         this.CHANGE_PROPERTY(data);
        },
    }
}))

